const userinfoRequierdKeys = ['username', 'userpwd']
const submitRequiredKeys = ['type', 'cause', 'destination', 'outProvince', 'transport']

// 验证各种参数的合法性 具体规则看代码
const isValidInput = str => str.length > 0
const isValidUsername = username => /^\d{12}$/.test(username)
const isValidPassword = password => /.{6,}/.test(password)
const isValidUserInfo = userinfo => userinfo instanceof Object && userinfoRequierdKeys.every(key => key in userinfo)
const isValidSubmitParam = param => param instanceof Object && submitRequiredKeys.every(key => key in param)

module.exports = {
  isValidInput,
  isValidUsername,
  isValidPassword,
  isValidUserInfo,
  isValidSubmitParam
}